<html>
	<head>
		<style>
			* { font-family: arial; font-size: 12px; }
			h1 { font-size: 20px;}
			h2 { font-size: 14px; }
			body { margin: 40px;}
			a { font-weight: bold; text-decoration: none; color: #000;}
			a:hover { text-decoration: underline; color: #333;}
			div.blog_title { color: #333; font-size: 13px; font-weight: bold;}
			div.blog_text { padding-left: 10px; margin-bottom: 20px;}
			fieldset { 	
				margin: 0; letter-spacing:1px;
				padding: 4px; border: 1px solid #ccc; width: 500px; margin-top: 30px;
			}
		</style>
		<title>Sparcle MVC - Blog</title>
	</head>
	<body>
		<a href="<?=View::url()?>index/">&raquo; Back to Index</a><br />
		<? if(!View::get('isInstalled')) : ?><a href="<?=View::url()?>Blog/Install/">&raquo; Install blog</a><br /><? endif ?>
		<? if(View::get('isInstalled')) : ?><a href="<?=View::url()?>Blog/Uninstall/">&raquo; Uninstall blog</a><br /><? endif ?>
		
		<h1>Simple Blog Example</h1>

		<? if(!View::get('isInstalled')) : ?>
			To install this blog example, you need to setup the database settings in de "framework/config/config.php" first then click on the Install blog link above this page.
		<? else: ?>
			<h2>Blog entries:</h2>
			<? foreach (View::get('BlogEntries') as $blog_item): ?>
				<div class="blog_title">
					<?=$blog_item['blog_title'];?>
				</div>
				<div class="blog_text">
					<?=nl2br($blog_item['blog_text']);?>
				</div>
			<? endforeach ?>
			
			<fieldset>
				<legend>Add new post</legend>
				<form method="post">
					<label for="blog_title">Title</label>
					<input type="text" name="blog_title" id="blog_title" value="Blog title example" /><br />
					<label for="blog_text">Message</label><br />
					<textarea cols="80" rows="5" name="blog_text" id="blog_text">Example text</textarea><br />
					<input type="submit" name="addEntry" value="Add Entry" />
				</form>
			</fieldset>
		<? endif ?>
	</body>
</html>